package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.core.FunctionHelper;

public class TAN extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    double d = 0.0D;
    Object localObject = null;
    for (int i = 0; i < paramArrayOfObject.length; ++i)
    {
      localObject = paramArrayOfObject[i];
      if (localObject instanceof Number)
      {
        d = Math.tan(((Number)localObject).doubleValue());
        break;
      }
    }
    return FunctionHelper.parsePrimitiveDouble(d);
  }

  public Function.Type getType()
  {
    return Function.MATH;
  }

  public String getCN()
  {
    return "TAN(number): 返回指定角度的正切值。\nNumber:待求正切值的角度，以弧度表示。如果参数是以度为单位的，乘以Pi()/180后转换为弧度。\n示例:\nTAN(0.8)等于1.029638557。\nTAN(45*Pi()/180)等于1。";
  }

  public String getEN()
  {
    return "TAN(number): Returns the tangent of the given angle.\nNumber    is the angle in radians for which you want the tangent.\n\nIf your argument is in degrees, multiply it by PI()/180 or use the RADIANS function to convert it to radians.\n\nExample:\n   TAN(0.8) = 1.029638557\n   TAN(45*Pi()/180) = 1";
  }
}